import { createApp } from "vue";
import "./style.css";
import App from "./App.vue";
import type { Food } from "./types/data";

createApp(App).mount("#app");

//ts 字面量
//a的类型是"hello" 就是一个写死的值  不能被改变
//通常和常量搭配使用
let a: "hello" = "hello";
// a = "123";
console.log(a);

//字面量+联合类型
type ForwordType = "东" | "南" | "西" | "北";
let forword: ForwordType = "北"; //限定只能在这范围内取值
console.log(forword);

//any类型  arkTS不允许any类型
//不会做类型的校验,可以设置任何的类型
let anyType: any;
anyType = 123;
anyType = "123";
anyType = true;
anyType = [1, 2, 3];
anyType = { name: "张三" };
console.log(anyType.name);
console.log(anyType);

//使用类型声明文件
const f: Food = {
  name: "苹果",
  date: "2021-01-01",
  price: 1.2,
};
